/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sc.utilidades.gui;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Toolkit;

/**
 *
 * @author r
 */
public class FormUtil extends FormPadrao {

    /**
     * CONSTRUTOR DA CLASSE
     */ 
    public FormUtil(FormPadrao formOwner) {
        this.formProprietario = formOwner;
        initComponents();
    }

    public FormPadrao formProprietario;
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public static void centralizarComponente(Component componente)  
    {  
      // Centraliza a janela de abertura no centro do desktop.  
        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();  
        Rectangle r      = componente.getBounds();  
      // Dimensões da janela  
        int widthSplash = r.width ;  
        int heightSplash = r.height;  
  
      // calculo para encontrar as cooredenadas X e Y para a centralização da janela.  
        int posX = (screen.width / 2) - ( widthSplash / 2 );  
        int posY = (screen.height / 2) - ( heightSplash / 2 );  
  
        componente.setBounds(posX,posY,widthSplash,heightSplash);  
  } 

    public static void maximizarFormulario(FormUtil form){
        form.setExtendedState(form.MAXIMIZED_BOTH);
    
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
